package com.example.blueconn.data;


import com.example.blueconn.utils.ArrayUtils;

import java.util.Arrays;

/**
 * Created by zhudongao
 * Desc
 * Date 2020/7/18
 */

public class DataBean {
    private int dataLength;
    private int deviceNum;
    private String cmd;
    private float[] datas;

    public DataBean() {

    }

    public DataBean(String cmd, int deviceNum, float[] datas) {
        this.cmd = cmd;
        this.deviceNum = deviceNum;
        this.datas = datas;
    }

    public int getDeviceNum() {
        return deviceNum;
    }

    public int getDataLength() {
        return dataLength;
    }

    public float[] getDatas() {
        return datas;
    }

    public void setDeviceNum(int deviceNum) {
        this.deviceNum = deviceNum;
    }

    public void setDataLength(int dataLength) {
        this.dataLength = dataLength;
    }

    public void setDatas(float[] datas) {
        this.datas = datas;
    }

    public String getCmd() {
        return cmd;
    }

    public String getTempData() {
        return String.valueOf(ArrayUtils.getData(datas, 0));
    }

    /**
     * 照度或湿度数据，根据设备编号来的,因为都是放在第二位。
     * @return 具体数据
     */
    public String getLOrHData() {
        return String.valueOf(ArrayUtils.getData(datas, 1));
    }

    public float getTemp() {
        return ArrayUtils.getData(datas, 0);
    }

    public float getLightOrHim() {
        return ArrayUtils.getData(datas, 1);
    }

    public int getLightInt() {
        return (int) ArrayUtils.getData(datas, 1);
    }

    public int getCharge() {
        int charge = (int) ArrayUtils.getData(datas, 2);
        return charge;
    }

    public float getParamOne() {
        return ArrayUtils.getData(datas, 0);
    }

    public float getParamTwo() {
        return ArrayUtils.getData(datas, 1);
    }

    public float getParamThree() {
        return ArrayUtils.getData(datas, 2);
    }

    @Override
    public String toString() {
        return "DataBean{" +
                "dataLength=" + dataLength +
                ", deviceNum=" + deviceNum +
                ", cmd='" + cmd + '\'' +
                ", datas=" + Arrays.toString(datas) +
                '}';
    }
}
